<template>
  <view class="my-disk">
    <uni-card :title="item.foodName" mode="style" :is-shadow="true"
      :thumbnail="item.photo" :extra="item.createTime">
      光盘心得体会：{{item.content?item.content:'今天的心情是什么样的呢'}}
    </uni-card>
  </view>
</template>

<script>
  import {uniCard} from '@dcloudio/uni-ui'
  import {mapState} from 'vuex'
  import {getDayDisk} from '../../api/disk.js'
  export default {
    name: 'my-disk',
    components: {
      uniCard
    },
    computed: {
      ...mapState(['userInfo'])
    },
    onLoad(options) {
        console.log(options.date)
        this.date = options.date
    },
    mounted() {
        this.getDisk()
    },
    data() {
      return {
        item: {},
        date: ''
      }
    },
    methods: {
      getDisk() {
        const data = {
          date: this.date,
          userId: this.userInfo.id
        }
        getDayDisk(data).then(res => {
          console.log(res)
          if (res.code === 200) {
            this.item = res.data
          } else {
            uni.showToast({
              title: res.message,
              duration: 2000,
              icon: 'none'
            });
          }
        })
      }
    },
  }
</script>

<style lang='scss'>
  page {
    background-color: #f5f5f5;
		height: 100%;
  }
  .my-disk {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
</style>
